package com.ywdnf.gomoku.model.chess;

import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/**
 * 坐标模型
 *
 * @author lss
 * @date 2019-06-25, Tue
 */
@Getter
@Setter
@AllArgsConstructor
@ToString
public class Point implements Serializable {

  private static final long serialVersionUID = 4958644533922626552L;

  /**
   * x坐标
   */
  public int x;

  /**
   * y坐标
   */
  public int y;

  public Point setXX(int x) {
    this.x = x;
    return this;
  }

  public Point setYY(int y) {
    this.y = y;
    return this;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }
    if (!(obj instanceof Point)) {
      return false;
    }
    Point p = (Point) obj;
    return this.x == p.x && this.y == p.y;
  }

  @Override
  public int hashCode() {
    int result = x;
    result = 31 * result + y;
    return result;
  }
}
